﻿
namespace CsvSegítő.exceptions
{
    using System;
    using System.Runtime.Serialization;
    public class CsvTypeConverterNotRegisteredException : CsvException
    {
        private readonly Type targetType;

        /// <summary>
        /// Initializes a new instance of the <see cref="CsvTypeConverterNotRegisteredException"/> class
        /// with a specified error message.
        /// </summary>
        /// <param name="targetType">The target type.</param>
        public CsvTypeConverterNotRegisteredException(Type targetType)
            : base()
        {
            this.targetType = targetType;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CsvTypeConverterNotRegisteredException"/> class
        /// </summary>
        /// <param name="targetType">The target type.</param>
        /// <param name="message">The message that describes the error.</param>
        public CsvTypeConverterNotRegisteredException(Type targetType, string message)
            : base(message)
        {
            this.targetType = targetType;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="CsvTypeConverterNotRegisteredException"/> class
        /// </summary>
        /// <param name="targetType">The target type.</param>
        /// <param name="message">The message that describes the error.</param>
        /// <param name="inner">The inner exception message.</param>
        public CsvTypeConverterNotRegisteredException(Type targetType, string message, Exception inner)
            : base(message, inner)
        {
            this.targetType = targetType;
        }

#if !PCL
        /// <summary>
        /// Initializes a new instance of the <see cref="CsvTypeConverterNotRegisteredException"/> class
        /// with serialized data.
        /// </summary>
        /// <param name="info">The <see cref="SerializationInfo"/> that holds the serialized object data about the exception being thrown.</param>
        /// <param name="context">The <see cref="StreamingContext"/> that contains contextual information about the source or destination.</param>
        public CsvTypeConverterNotRegisteredException(SerializationInfo info, StreamingContext context) : base(info, context) { }
#endif
        public override string ToString()
        {
            return $"CsvTypeConverterNotRegisteredException (TargetType = {targetType})";
        }

    }
}
